﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Utility.jqGrid
{
    /// <summary>
    /// jqGrid查询Json数据
    /// </summary>
    [DataContract]
    public class jqGridFilter
    {
        //  {"groupOp":"AND","rules":[{"field":"email","op":"cn","data":"1"},{"field":"orderno","op":"ge","data":"2"}]}
        private string groupOp = "AND";
        private List<jqGridFilterRules> jqGridFilterRulesList;
        [DataMember(Name = "groupOp")]
        public string GroupOp
        {
            get { return groupOp; }
            set { groupOp = value; }
        }
        [DataMember(Name = "rules")]
        public List<jqGridFilterRules> JqGridFilterRulesList
        {
            get { return jqGridFilterRulesList; }
            set { jqGridFilterRulesList = value; }
        }
    }
    /// <summary>
    /// 解析jqGrid查询Json数据{"field":"orderno","op":"ge","data":"2"}
    /// </summary>
    [DataContract]
    public class jqGridFilterRules
    {
        private string field;
        private string op;
        private string data;
        [DataMember(Name = "field")]
        public string Field
        {
            get { return field; }
            set { field = value; }
        }
        [DataMember(Name = "op")]
        public string Op
        {
            get { return op; }
            set { op = value; }
        }
        [DataMember(Name = "data")]
        public string Data
        {
            get { return data; }
            set { data = value; }
        }
    }
}